-# 
-# Archives
-#

.module
  #archives
    %h1 Archives

    %table
      %tr{:style => "vertical-align: top;"}
        - counts = Post.count_by_months
        - years = [Time.now.utc.year, Time.now.utc.year - 1, Time.now.utc.year - 2]
        - for year in years
          %td
            - year = year.to_s
            - next unless counts[year]
            %span.year
              = "#{link_to year, :controller => :searches, :action => :dates, :year => year } (#{counts[year][:total]})<br/>"
            - months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
            - for month in months
              - next unless counts[year][month.intern]
              %span.month
                = "#{link_to month, :controller => :searches, :action => :dates, :year => year, :month => month} (#{counts[year][month.intern]}) <br/>" if counts[year][month.intern] 